<?php 
define('IN_ECS', true);
// require(dirname(dirname(__FILE__)) . '/includes/init.php');
include_once(dirname(__FILE__) . '/cls_ruitai.php');
$cgid = $_GET["cgid"];
$openid = $_POST["openid"];
$code = $_POST["code"];
echo $openid;
echo $code;
echo "111";
echo "<br/>";
return;
$sql = 'SELECT typ from tage_integral_goods where cgid ='.$cgid;
$sql2 = "SELECT user_id from tage_users where wxopenid ='$openid'";
$arr_cgid = $db -> getRow($sql);
$arr_userid = $db -> getRow($sql2);

$typ=$arr_cgid['typ'];
$userid=$arr_userid['user_id'];
// echo $userid;
// return;
if($typ == 0)
{
	$smarty->assign("loginname",$loginname);
    $smarty->assign("mobile",$mobile);
    $smarty->assign("area",$area);
    $smarty->assign("shop",$shop);
    $smarty->assign("address",$address);
    $smarty->display("jfinformation.dwt");
}
else
{
    // include_once(dirname(__FILE__) . '/cls_ruitai.php');
    $rtuitai=new PartnerCls();
    
    $code = "000000315116251924";
    $userid ="";
    // $cgid = "115";
    $rtuitai->QueryInfo($code);
    $rtuitai->CheckInfo($code,$userid,$cgid);
    // echo "<hr/>";
    echo  $rtuitai->getAmount();
    // echo "</br>";
    echo "<script type='text/javascript'>alert('兑换成功');location='javascript:history.back()';</script>";
}

?>